package com.fast.alden.data.model;

import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.Transient;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * 树形结构实体基类，声明树形实体类型共有属性
 */
@Getter
@Setter
@MappedSuperclass
public abstract class BaseTreeNodeEntity extends BaseEntity implements ITreeNode {
    /**
     * 父级节点ID，最顶级节点的父级节点ID是Null
     */
    private Long parentId;
    /**
     * 根级节点ID，最顶级节点的根ID是自身
     */
    private Long rootId;
    /**
     * ID路径
     */
    private String idPath;
    /**
     * 子级节点列表
     */
    @Transient
    private List<BaseTreeNodeEntity> children = new ArrayList<>();
}
